home *** CD-ROM | disk | FTP | other *** search
/ PC User 2003 December / Australian PC User - December 2003 (CD2).iso / software / apps / files / dwmx2k4.exe / Disk1 / data1.cab / Configuration_En / Objects / Server / DynamicTextField.js < prev    next >
Encoding:
JavaScript  |  2003-09-05  |  4.5 KB  |  166 lines

  1. // Copyright 2001, 2002, 2003 Macromedia, Inc. All rights reserved.
  2.  
  3. // *************** GLOBALS VARS *****************
  4.  
  5. // ******************* API **********************
  6.  
  7. //--------------------------------------------------------------------
  8. // FUNCTION:
  9. //   objectTag
  10. //
  11. // DESCRIPTION:
  12. //   This object is used as a shim to launch the appropriate 
  13. //   server behavior for the current server model.  The individual
  14. //   server behavior files are responsible for inserting the code on the
  15. //   page, so this function just returns the empty string.
  16. //
  17. // ARGUMENTS:
  18. //   none
  19. //
  20. // RETURNS:
  21. //   string - empty string to indicate that nothing should be inserted
  22. //--------------------------------------------------------------------
  23.  
  24. function objectTag() 
  25. {
  26.   var dom = dw.getDocumentDOM();
  27.   
  28.   if (dom)
  29.   {
  30.     var serverModel = dom.serverModel.getFolderName();
  31.     
  32.     if (serverModel)
  33.     {    
  34.       var serverBehaviorFile = "";
  35.  
  36.       switch (serverModel)
  37.       {
  38.       case "ASP_VBS":
  39.       case "ASP_JS":
  40.       case "JSP":
  41.         serverBehaviorFile = "Dynamic Textfield.htm";
  42.         break;
  43.  
  44.       case "ASP.NET_Csharp":
  45.       case "ASP.NET_VB":
  46.         // not supported
  47.         break;
  48.  
  49.       case "ColdFusion":
  50.         serverBehaviorFile = "DynamicTextfield.htm";
  51.         break;
  52.  
  53.       case "PHP_MySQL":
  54.         serverBehaviorFile = "DynTextField.htm";
  55.         break;
  56.  
  57.       default:
  58.         // We will launch a server behavior with a default name
  59.         // so that live objects can be implemented
  60.         // for third party server models.
  61.  
  62.         serverBehaviorFile = "DynamicTextField.htm";        
  63.         break;
  64.       } 
  65.  
  66.       if (serverBehaviorFile && canInsertServerObject(serverBehaviorFile))
  67.       {
  68.         dw.popupServerBehavior(serverBehaviorFile);
  69.       }
  70.     }
  71.     else
  72.     {
  73.       alert(MM.MSG_NeedServerModelForSO);
  74.     }
  75.   }
  76.   
  77.   return "";  
  78. }
  79.  
  80.  
  81. //--------------------------------------------------------------------
  82. // FUNCTION:
  83. //   canInsertServerObject
  84. //
  85. // DESCRIPTION:
  86. //   The function returns true if this object can be inserted in the
  87. //   current document.  This function, and the functions it calls should
  88. //   display the necessary error messages.
  89. //
  90. // ARGUMENTS:
  91. //   sbFileName - string - the file name of the server behavior file
  92. //     which implements this object
  93. //
  94. // RETURNS:
  95. //   boolean - true if the dialog should be displayed, or false otherwise
  96. //--------------------------------------------------------------------
  97.  
  98. function canInsertServerObject(sbFileName)
  99. {
  100.   var retVal = true;
  101.  
  102.   var curDom = dw.getDocumentDOM();
  103.   var serverModel = (curDom) ? curDom.serverModel.getFolderName() : "";
  104.   var path = dw.getConfigurationPath() + "/ServerBehaviors/" + serverModel
  105.            + "/" + sbFileName;
  106.            
  107.   if (!dwscripts.fileExists(path))
  108.   {
  109.     var err = dwscripts.sprintf(MM.MSG_NeedCommandFileForSO, path);
  110.     retVal = false;
  111.     alert(err);
  112.   }
  113.   
  114.   return retVal;
  115. }
  116.  
  117. //--------------------------------------------------------------------
  118. // FUNCTION:
  119. //   getSetupSteps
  120. //
  121. // DESCRIPTION:
  122. //   Returns an array of steps to be displayed in an instructions
  123. //   dialog.  The first element of the array is the text that appears
  124. //   above the list.  The remaining elements are the steps, which will
  125. //   be rendered in a numbered list.
  126. //
  127. //   The steps are each HTML, which may contain JavaScript event
  128. //   handlers.  The event handlers can either be a JavaScript script
  129. //   or an "event:KeyWord" syntax.  If the latter is used, then the
  130. //   handler for KeyWord is implemented internally in the Dreamweaver
  131. //   executable.
  132. //
  133. // ARGUMENTS:
  134. //   none
  135. //
  136. // RETURNS:
  137. //   the array described above
  138. //--------------------------------------------------------------------
  139. function getSetupSteps()
  140. {
  141.   return getSetupStepsForServerObject();
  142. }
  143.  
  144.  
  145.  
  146. //--------------------------------------------------------------------
  147. // FUNCTION:
  148. //   setupStepsCompleted
  149. //
  150. // DESCRIPTION:
  151. //   Returns the number of steps (in the list of steps returned from
  152. //   getSetupSteps) that have already been completed.  This number is
  153. //   used to determine how many steps will have a check mark next to
  154. //   them.
  155. //
  156. // ARGUMENTS:
  157. //   none
  158. //
  159. // RETURNS:
  160. //   An integer - the number of check marks to be displayed, or -1
  161. //   if all steps have been completed.
  162. //--------------------------------------------------------------------
  163. function setupStepsCompleted()
  164. {
  165.   return setupStepsCompletedForServerObject();
  166. }